package com.season.seasonStudy.javase.j_017_enum0;

public class AppleTestDrive {
	public static void main(String[] args) {
		Apple a = Apple.红富士;
		Apple b = Apple.红富士;
		System.out.println(a);
		// Apple a = new Apple();
		// 不能被实例化

		System.out.println(a.price);

		Apple.values();// 返回下面所有静态变量数组
		for (Apple s : Apple.values()) {
			System.out.println(s);
		}

		if (a == b) {// 判断ab是否一样
			System.out.println("品种一样");
		}

		if ("红富士".equals(b)) {// 判断ab是否一样 字符串，静态
			System.out.println("一样");
		}// 判断枚举值用switch

		switch (a) {
		case 北斗:// 这可不是字符串哦

			break;

		default:
			break;
		}

		Apple aa = Apple.valueOf("北斗");
		System.out.println("aa");

		a.ordinal();// 返回下标，从0开始
		System.out.println(a.ordinal());
		Apple aaa = Apple.金帅;
		aaa.compareTo(aa);// 返回两者之间下表差

		Apple apple1 = Apple.aaa;
		Apple apple2 = Apple.红星;
		System.out.println(apple1.price);
		System.out.println(apple2.price);
		apple1.s(2);
		apple2.s(3);
		System.out.println(apple1.price);
		System.out.println(apple2.price);
		apple1.price = 5;
		apple2.price = 9;
		System.out.println(apple1.price);
		System.out.println(apple2.price);
	}

}
